package com.systop.asset.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.systop.asset.entity.RestResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.systop.asset.entity.DisposalDetail;
import com.systop.asset.service.IDisposalDetailService;

/**
 * 处置单明细Controller
 * 
 * @author mc
 * @date 2025-07-03
 */
@RestController
@RequestMapping("/system/disposalDetail")
public class DisposalDetailController
{
    @Autowired
    private IDisposalDetailService disposalDetailService;

    /**
     * 查询处置单明细列表
     */
    @GetMapping("/list")
    public RestResponse list(DisposalDetail disposalDetail)
    {
        List<DisposalDetail> list = disposalDetailService.selectDisposalDetailList(disposalDetail);
        return RestResponse.success(list);
    }


    /**
     * 获取处置单明细详细信息
     */
    @GetMapping(value = "/{id}")
    public RestResponse getInfo(@PathVariable("id") Long id)
    {
        return RestResponse.success(disposalDetailService.selectDisposalDetailById(id));
    }

    /**
     * 新增处置单明细
     */
    @PostMapping
    public RestResponse add(@RequestBody DisposalDetail disposalDetail)
    {
        return RestResponse.success(disposalDetailService.insertDisposalDetail(disposalDetail));
    }

    /**
     * 修改处置单明细
     */
    @PutMapping
    public RestResponse edit(@RequestBody DisposalDetail disposalDetail)
    {
        return RestResponse.success(disposalDetailService.updateDisposalDetail(disposalDetail));
    }

    /**
     * 删除处置单明细
     */
	@DeleteMapping("/{ids}")
    public RestResponse remove(@PathVariable Long[] ids)
    {
        return RestResponse.success(disposalDetailService.deleteDisposalDetailByIds(ids));
    }
}
